package com.study.mythread.model;

/**
 * @program: java-study-of-learner
 * @description: 实现Runnable接口
 * @author: future
 * @create: 2021-01-16 19:02
 **/
public class MyRunnable implements Runnable {
    //runnable中的run是实现业务逻辑
    public void run() {
        int num = 0;
        while(num != 20){
            num++;
            System.out.println(Thread.currentThread().getName()+" runnable中实现的业务逻辑 "+num);
        }
    }

    public static void main(String[] args) {
        Thread t1 = new Thread(new MyRunnable());
        t1.start();
        Thread t2 = new Thread(new MyRunnable());
        t2.start();
    }
}
